package com.jier.vo;

import com.jier.common.util.DateUtil;
import com.jier.entities.BaseEntity;

import java.util.Date;

/**
 * 基础视图
 *
 * @author jie_r
 */
public class BaseVo {
    /**
     * 实体ID
     */
    private Integer id;

    /**
     * 更新时间
     */
    private String updateDate;

    /**
     * 创建时间
     */
    private String createDate;

    public BaseVo(Integer id, String updateDate, String createDate) {
        this.id = id;
        this.updateDate = updateDate;
        this.createDate = createDate;
    }

    public BaseVo(Integer id, Date updateDate, Date createDate) {
        this.id = id;
        this.updateDate = DateUtil.formatTime(updateDate);
        this.createDate = DateUtil.formatTime(createDate);
    }

    public BaseVo(BaseEntity entity) {
        this.id = entity.getId();
        this.updateDate = DateUtil.formatTime(entity.getUpdateDate());
        this.createDate = DateUtil.formatTime(entity.getCreateDate());
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(String updateDate) {
        this.updateDate = updateDate;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }
}
